if (!window.webclient) webclient = {};
webclient.Request = function() {  };

webclient.Request.prototype.has_login = function() { return ( this.login != null ); };

webclient.Request.prototype.has_open = function() { return ( this.open != null ); };

webclient.Request.prototype.has_submit = function() { return ( this.submit != null ); };

webclient.Request.prototype.serialize = function()
{
	var data = {};
	data["1"] = this.session_id;
	data["2"] = this.client_ack;
	data["3"] = this.client_sequence_number;
	if ( this.has_login() ) {
	data["10"] = this.login.serialize();
	}
	if ( this.has_open() ) {
	data["11"] = this.open.serialize();
	}
	if ( this.has_submit() ) {
	data["12"] = this.submit.serialize();
	}
	return data;
};

webclient.Request.parse = function(data)
{
	if ( !data ) return null;
	var obj = new webclient.Request();
	obj.session_id = data["1"];
	obj.client_ack = data["2"];
	obj.client_sequence_number = data["3"];
	obj.login = webclient.LoginRequest.parse( data["10"] );
	obj.open = waveserver.ProtocolOpenRequest.parse( data["11"] );
	obj.submit = waveserver.ProtocolSubmitRequest.parse( data["12"] );
	if ( !obj.session_id == null ) throw "Missing field session_id";
	if ( !obj.client_ack == null ) throw "Missing field client_ack";
	if ( !obj.client_sequence_number == null ) throw "Missing field client_sequence_number";
	return obj;
};

webclient.Response = function() {  };

webclient.Response.prototype.has_error_message = function() { return ( this.error_message != null ); };

webclient.Response.prototype.has_login = function() { return ( this.login != null ); };

webclient.Response.prototype.has_update = function() { return ( this.update != null ); };

webclient.Response.prototype.has_submit = function() { return ( this.submit != null ); };

webclient.Response.prototype.serialize = function()
{
	var data = {};
	if ( this.has_error_message() ) {
	data["1"] = this.error_message;
	}
	data["2"] = this.server_ack;
	data["3"] = this.server_sequence_number;
	if ( this.has_login() ) {
	data["10"] = this.login.serialize();
	}
	if ( this.has_update() ) {
	data["11"] = this.update.serialize();
	}
	if ( this.has_submit() ) {
	data["12"] = this.submit.serialize();
	}
	return data;
};

webclient.Response.parse = function(data)
{
	if ( !data ) return null;
	var obj = new webclient.Response();
	obj.error_message = data["1"];
	obj.server_ack = data["2"];
	obj.server_sequence_number = data["3"];
	obj.login = webclient.LoginResponse.parse( data["10"] );
	obj.update = waveserver.ProtocolWaveletUpdate.parse( data["11"] );
	obj.submit = waveserver.ProtocolSubmitResponse.parse( data["12"] );
	if ( !obj.server_ack == null ) throw "Missing field server_ack";
	if ( !obj.server_sequence_number == null ) throw "Missing field server_sequence_number";
	return obj;
};

webclient.LoginRequest = function() {  };

webclient.LoginRequest.prototype.serialize = function()
{
	var data = {};
	data["1"] = this.jid;
	return data;
};

webclient.LoginRequest.parse = function(data)
{
	if ( !data ) return null;
	var obj = new webclient.LoginRequest();
	obj.jid = data["1"];
	if ( !obj.jid == null ) throw "Missing field jid";
	return obj;
};

webclient.LoginResponse = function() {  };

webclient.LoginResponse.prototype.serialize = function()
{
	var data = {};
	data["1"] = this.session_id;
	return data;
};

webclient.LoginResponse.parse = function(data)
{
	if ( !data ) return null;
	var obj = new webclient.LoginResponse();
	obj.session_id = data["1"];
	if ( !obj.session_id == null ) throw "Missing field session_id";
	return obj;
};

